﻿using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Effects;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Documents;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using 纸片人.CalculateControls;
using 纸片人.ConvertClass;
using 纸片人.win2dEffectControl.DataClass;

// The Templated Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234235

namespace 纸片人.win2dEffectControl
{
    public class DisplacementMapEffectControl : TwoSourceEffectControl
    {
        ComboBox xChannelSelectCombo;
        ComboBox yChannelSelectCombo;
        TextBoxSlider offsetAmountSlider;
       
        List<EffectChannelSelect> listChannelSelect = new List<EffectChannelSelect>();

      

        public DisplacementMapEffectControl()
        {
            this.DefaultStyleKey = typeof(DisplacementMapEffectControl);
            listChannelSelect = EffectUtil.GetEnumList<EffectChannelSelect>();
            TwoEffectData = new DisplacementMapEffectData();
        }

        public override EffectTwoSourceData TwoEffectData { get; set; }

        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            SetEffectName("置换扭曲", "DisplacementMapEffect");
            xChannelSelectCombo = GetTemplateChildFormName<ComboBox>(nameof(xChannelSelectCombo));
            SetComboBox(xChannelSelectCombo, listChannelSelect, TwoEffectData, nameof(DisplacementMapEffectData.XchannelSelect));


            yChannelSelectCombo = GetTemplateChildFormName<ComboBox>(nameof(yChannelSelectCombo));
            SetComboBox(yChannelSelectCombo, listChannelSelect, TwoEffectData, nameof(DisplacementMapEffectData.YchannelSelect));

            offsetAmountSlider = GetTemplateChildFormName<TextBoxSlider>(nameof(offsetAmountSlider));
            SetTextBoxSlider(offsetAmountSlider, TwoEffectData, nameof(DisplacementMapEffectData.Amount));
        }


     

 

       

   

       
    }
}
